<?php $this->load->view('common/head');?>
<?php $this->load->view('common/navbar');?>
<style type="text/css">
	.form-group{margin-top:10px; }
</style>
<!-- 查询框开始 -->
<div class="table-responsive">
<form class="form-inline" method="GET" name="query" id="query">
<input type="hidden" name="c" id="c" value="<?=$this->input->get('c')?>">
<input type="hidden" name="m" id="m" value="<?=$this->input->get('m')?>">
  <div class="form-group">
    <label for="area">地区:</label>
    <select class="form-control" id="area" name="area">
	  <option value="">请选择地区</option>
	</select>
  </div>
  <div class="form-group">
    <label for="region">大区:</label>
    <select class="form-control" id="region" name="region">
	  <option value="">请选择大区</option>
	</select>
  </div>
  <div class="form-group">
    <label for="spsarea">小区:</label>
    <select class="form-control" id="spsarea" name="spsarea">
	  <option value="">请选择小区</option>
	</select>
  </div>
  <div class="form-group">
    <label for="province">省份:</label>
    <select class="form-control" id="province" name="province">
	  <option value="">请选择省份</option>
	</select>
  </div>
  <div class="form-group">
    <label for="city">城市:</label>
    <select class="form-control" id="city" name="city">
	  <option value="">请选择城市</option>
	</select>
  </div>
  <div class="form-group">
    <label for="storeId">专营店:</label>
    <select class="form-control" id="storeId" name="storeId">
	  <option value="">请选择专营店</option>
	</select>
  </div>
  <div class="form-group">
    <label for="year">所属年份：</label>
    <select class="form-control" id="year" name="year">
      <option value="">请选择</option>
	</select>
  </div>
  <div class="form-group">
    <label for="timeUnit">所属双月：</label>
    <select class="form-control" id="timeUnit" name="timeUnit">
      <option value="">请选择</option>
	</select>
  </div>
  <div class="form-group">
    <label for="keyword">关键字：</label>
    <input type="text" class="form-control" name="keyword" id="keyword" value="<?=$keyword?>" placeholder="关键字">
  </div>
  <div class="form-group">
  	<button type="submit" class="btn btn-default btn-primary">搜索</button>
  </div>
</form>
</div>
<!-- 查询框结束 -->

<!-- 表格列表 -->
<div style="margin-top: 10px;">
<table class="table table-hover table-bordered table-condensed">
	<thead>
	  <tr>
	    <th class="bg-primary text-center">地区</th>
	    <th class="bg-primary text-center">大区</th>
	    <th class="bg-primary text-center">专营店名称</th>
	    <th class="bg-primary text-center">所属双月</th>
	    <th class="bg-primary text-center">预算申请金额</th>
	    <th class="bg-primary text-center">结算申请金额</th>
	    <th class="bg-primary text-center">审核情况</th>
	    <th class="bg-primary text-center">结算审批金额</th>
	    <th class="bg-primary text-center">操作</th>
	  </tr>
	</thead>
	<tbody>
	  <?php foreach ($procList as $k => $v) {?>
	  <tr>
	    <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['area'] : ''?></td>
	    <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['region'] : ''?></td>
	    <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['storeName'] : ''?></td>
	    <td class="text-center"><?=$v['timeUnitStr']?></td>
	    <td class="text-center"><?=$v['budgetApply']?></td>
	    <td class="text-center"><?=$v['settleApply']?></td>
	    <td class="text-center">
	    	<?php if($v['auditCount']){ ?>
        	<div class="center-block">
        	<p class="bg-success">已通过：<?php echo $v['auditCount'][1] ?></p>
			<p class="bg-warning">不通过：<?php echo $v['auditCount'][2] ?></p>
			<p class="bg-info">部分通过：<?php echo $v['auditCount'][4] ?></p>
			<p class="bg-danger">返回修改：<?php echo $v['auditCount'][3] ?></p>
			<p class="bg-info">未审核：<?php echo $v['auditCount'][0] ?></p>
			<p class="bg-warning">未提交：<?php echo $v['auditCount'][-1] ?></p>
			</div>
			<?php } ?>
	    </td>
	    <td class="text-center"><?=$v['settleAudit']?></td>
	    <td class="text-center">
	    	<?php if ($this->auth->isCarSettleAudit($v)) {?>
        	<a class="btn btn-default btn-sm" role="button" href="<?php echo printUrl('CarSettle','adminAudit', array('procId'=>$v['id'])); ?>">结算审核</a>
        	<?php } ?>
        	<?php if ($this->auth->isCarSettleChange($v)) {?>
        	<a class="btn btn-default btn-sm" role="button" href="<?php echo printUrl('CarSettle','adminChange', array('procId'=>$v['id'])); ?>">修改金额</a>
        	<?php } ?>
	    	<?php if ($this->auth->isCarSettleCheck($v)) {?>
        	<a class="btn btn-default btn-sm" role="button" href="<?php echo printUrl('CarSettle','check', array('procId'=>$v['id'])); ?>">查看详细</a>
        	<?php } ?>
	    </td>
	  </tr>
	  <?php } ?>
	</tbody>
</table>
</div>
<!-- 分页 -->
<?=$pager?>
<script type="text/javascript">
	$(function(){
		loadYearList('year',<?=$year ? $year : 0?>);
	    loadTimeUnitList('timeUnit',<?=$year ? $year : 0?>,<?=$timeUnit ? $timeUnit : 0?>);
		loadPlaceList('area', 'area', '', '<?=$area?>');
		loadPlaceList('region', 'region', '<?=$area?>', '<?=$region?>');
		loadPlaceList('spsarea', 'spsarea', '<?=$region?>', '<?=$spsarea?>');
		loadPlaceList('province', 'province', '<?=$spsarea?>', '<?=$province?>');
		loadPlaceList('city', 'city', '<?=$province?>', '<?=$city?>');
		loadPlaceList('storeId', 'store', '<?=$city?>', '<?=$storeId?>');
	});
    $("#year").change(function(){
      loadTimeUnitList('timeUnit',this.value);
    });
	$('#area').change(function(){
		loadPlaceList('region', 'region', this.value, '');
		loadPlaceList('spsarea', 'spsarea', '', '');
		loadPlaceList('province', 'province', '', '');
		loadPlaceList('city', 'city', '', '');
		loadPlaceList('storeId', 'store', '', '');
	});
	$('#region').change(function(){
		loadPlaceList('spsarea', 'spsarea', this.value, '');
		loadPlaceList('province', 'province', '', '');
		loadPlaceList('city', 'city', '', '');
		loadPlaceList('storeId', 'store', '', '');
	});
	$("#spsarea").change(function(){
		loadPlaceList('province', 'province', this.value, '');
		loadPlaceList('city', 'city', '', '');
		loadPlaceList('storeId', 'store', '', '');
	});
	$('#province').change(function(){
		loadPlaceList('city', 'city', this.value, '');
		loadPlaceList('storeId', 'store', '', '');
	});
	$('#city').change(function(){
		loadPlaceList('storeId', 'store', this.value, '');
	});
</script>
<?php $this->load->view('common/foot');?>